<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class AdInputDTO extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     * 'groupId', 'name', 'email', 'mobile'
     * @return array
     */
    public function rules()
    {
        return [
            'text' => 'required|max:20',
            'description' => 'required|max:200',
            'picture' => 'required|max:200',
            'space_id' => 'required',
            'plate_type' => 'required',
            'link' => 'required',
            'sort' => 'required',
            'begin' => 'required',
            'end' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'text.required' => '广告描述不能为空',
            'text.max' => '广告描述不能超过20个字符',
            'description.required' => '广告用途不能为空',
            'description.max' => '广告用途不能超过200个字符',
            'type_id.required' => '栏目不能为空',
            'plate_type.required' => '链接类型不能为空',
            'picture.required' => '图片地址不能为空',
            'picture.max' => '图片地址不能超过200个字符',
            'space_id.required' => '广告位不能为空',
            'link.required' => '广告链接地址不能为空',
            'sort.required' => '排序不能为空',
            'begin.required' => '广告开始时间不能为空',
            'end.required' => '广告结束时间不能为空',
        ];
    }
}
